				
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3/jquery.min.js"></script>  
<script type="text/javascript">
function validateEmail(txtEmail){
	   var a = txtEmail;
	   var filter = /^[a-zA-Z0-9_.-]+@[a-zA-Z0-9]+[a-zA-Z0-9.-]+[a-zA-Z0-9]+.[a-z]{1,4}$/;
	    if(filter.test(a)){
	        return true;
	    }
	    else{
	        return false;
	    }
	}
	
function validateContact(txtEmail){
	   var a = txtEmail;
	   var filter = /^[0-9]+$/;
	    if(filter.test(a)){
	        return true;
	    }
	    else{
	        return false;
	    }
	}
$(document).ready(function(){
	
	$.get("../../bind?id=soc_name",function(data){
		$("#soc_name").html(data);
	});
	
	$("#update_resp").click(function(){
		
		var names;
		var resps;
		
		$(".mem_name").each(function(){
		    var name = $(this).val();

		    if(names == undefined)
		    	names = name;
		    else
		    	names = names + "," + name; 
		});
		
		$(".mem_resp").each(function(){
		    var resp = $(this).val();
		    
		    if(resps == undefined)
		    	resps = resp;
		    else
		    	resps = resps + "," + resp; 
		});
		
		$.post("../../society-setup", {id : "update", name_list : names, resp_list : resps}, function(data){
			$("#msg_update_resp").html(data);
			$("#msg_update_resp").css("display", "block");
		});
	});
	
	$("#save_member").click(function(e) {
		
		var mem_addr = $("#address option:selected").text();
		var mem_name = $("#name").val();
		var mem_resp = $(".add_resp option:selected").val();
		var email = $("#email").val();
		var contact = $("#contact").val();
		
		if(mem_name == "") {
			$("#msg_add_mem").html("<span style='color:red'>Enter name</span>");
			$("#msg_add_mem").css("display","block");
			
			return false;
		}
		
		if(!validateEmail(email))
		{
			$("#msg_add_mem").html("<span style='color:red'>Enter valid email ID</span>");
			$("#msg_add_mem").css("display","block");
			
			return false;
		}
		
		if(!validateContact(contact))
		{
			$("#msg_add_mem").html("<span style='color:red'>Enter valid Number</span>");
			$("#msg_add_mem").css("display","block");
			
			return false;
		}
		
		var mem = mem_addr + " " + mem_name;
		
		$.post("../../society-setup" , {id : "add_mem", name : mem, resp : mem_resp, mail : email, contact_no : contact}, function(data){
			$("#msg_add_mem").html(data);
			$("#msg_add_mem").css("display", "block");
		});
	});
	

	$("#remove_member").click(function(e) {
		
		var mem_name = $(".rem_member option:selected").val();
		
		var answer = confirm("Do you really want to delete " + mem_name  + "?");
		if(!answer) {
			return false;
		}
		
		$.post("../../society-setup" , {id : "rem_mem", name : mem_name}, function(data){
			$("#msg_rem_mem").html(data);
			$("#msg_rem_mem").css("display", "block");
		});
	});
	
});

</script>


<br class=\"clearfix\"/>
		
</div>
</div>

</body>
</html>